package Function.ItemUse;

import FCRendering.FCRBattleOrderConstant;
import VWorldGameStudio.*;

import static FCRendering.FCRMaster.fcv;

public class FoodZaiShengWan extends AItemUse{
    @Override
    public ItemUseResult directUse() {
        return useForPlayerTarget(keepPlayer);
    }

    @Override
    public ItemUseResult useInMapTarget(int x, int y) {
        return useForPlayerTarget(keepPlayer);
    }

    @Override
    public ItemUseResult useForMonsterTarget(FCBattleOrder battleOrder, FCMonster m) {
        return new ItemUseResult().useless();
    }

    @Override
    public ItemUseResult useForPlayerTarget(FCPlayerInfo p) {
        fcv.closeAllShowWindw();
        if(!p.isDeath()){
            fcv.getMessage().add("只能给死者使用,什么也没发生");
            fcv.showMessage();
            return new ItemUseResult().useless();
        }

        if(fcv.isBattle()) {
            FCPlayerBattleWrap wrap = FCPlayerBattleWrap.findBattleWrapByName(p.getAliasUID(), p.getName());
            wrap.rebornRemoveAllState();
        }
        p.getLongTermMap().clear();
        p.setBlood(p.getBloodMax());
        p.setPhysicalnum(p.getPhysical());
        fcv.getMessage().add(p.getChName()+" 复活了");
        fcv.showMessage();
        useAfter();
        return new ItemUseResult();
    }

    @Override
    public ItemUseResult useForTankTarget(FCTank t) {
        return useForPlayerTarget(keepPlayer);
    }
}
